<?php
final class HouseKeepingPresetMessageLanguageModel {
	private $mysql;
	private $tableName = 'HouseKeepingPresetMessageLanguage';
	public $idRowName = 'HouseKeepingPresetMessageLanguage_ID';
	public $messageidRowName = 'HouseKeepingPresetMessage_ID';
	public $textRowName = 'HouseKeepingPresetMessageLanguage_text';
	public $langCodeRowName = 'Language_Code';
	public $CountRowName = 'HouseKeepingPresetMessageLanguage_Count';
	public function __construct ($mysql) {
		$this->mysql = $mysql;
	}

	public function GetHouseKeepingLanguageByMessageID ($id, $lang = "en-US") {
		$ref = NULL;
		$sqlresult = $this->mysql->query (sprintf ('SELECT `%s`, `%s`, `%s`, `%s` FROM `%s` WHERE `%s`=%d AND `%s`=\'%s\';', $this->mysql->escape_string ($this->idRowName), $this->mysql->escape_string ($this->messageidRowName), $this->mysql->escape_string ($this->textRowName), $this->mysql->escape_string ($this->langCodeRowName), $this->mysql->escape_string ($this->tableName), $this->mysql->escape_string ($this->messageidRowName), $this->mysql->escape_string ($id), $this->mysql->escape_string ($this->langCodeRowName), $this->mysql->escape_string ($lang)));
		$len = $sqlresult->affected_rows ();
		if ($len > 0) {
			$ref = $sqlresult->fetch_array ();
//			$ref['sql']= sprintf ('SELECT `%s`, `%s`, `%s`, `%s` FROM `%s` WHERE `%s`=%d AND `%s`=\'%s\';', $this->mysql->escape_string ($this->idRowName), $this->mysql->escape_string ($this->messageidRowName), $this->mysql->escape_string ($this->textRowName), $this->mysql->escape_string ($this->langCodeRowName), $this->mysql->escape_string ($this->tableName), $this->mysql->escape_string ($this->messageidRowName), $this->mysql->escape_string ($id), $this->mysql->escape_string ($this->langCodeRowName), $this->mysql->escape_string ($lang));
		}
		$sqlresult->free_result ();
		return $ref;
	}

	public function GetHouseKeepingLanguageByMessage ($text) {
		$ref = NULL;
		$sqlresult = $this->mysql->query (sprintf ('SELECT `%s`, `%s`, `%s`, `%s` FROM `%s` WHERE `%s`=\'%s\';', $this->mysql->escape_string ($this->idRowName), $this->mysql->escape_string ($this->messageidRowName), $this->mysql->escape_string ($this->textRowName), $this->mysql->escape_string ($this->langCodeRowName), $this->mysql->escape_string ($this->tableName), $this->mysql->escape_string ($this->textRowName), $this->mysql->escape_string ($text)));
		$len = $sqlresult->affected_rows ();
		if ($len > 0) {
			$ref = $sqlresult->fetch_array ();
		}
		$sqlresult->free_result ();
		return $ref;
	}


}
?>
